<div style="padding:10px;">
<form id="menu_f" method="post">
    <table cellpadding="5">
        <tr>
            <td>名称:</td>
            <td><input class="easyui-textbox" type="text" name="menu_title" data-options="required:true" style="width:200px;"></input></td>
        </tr>
        <tr>
            <td>类型:</td>
            <td><select class="easyui-combobox" name='menu_level' id="menu_level" data-options="panelHeight:'auto',required:true,editable:false" style="width:200px;">
				<?php 
                $type = array('根节点','板块','模块','操作');
                for ($i=0; $i<=3; $i++)
                {
                    echo "<option value='".$i."' ";
                    echo ($menuinfo[0]['level'] == $i)?"selected='selected'":"";
                    echo ">".$type[$i]."</option>";	
                }
                ?>
            </select>
            
            </td>
        </tr>
        <tr>
            <td>父节点:</td>
            <td><input class="easyui-combobox" id="menu_parent_id" name="parent_id" style="width:200px;"></td>
        </tr>
        <tr>
            <td>链接:</td>
            <td><input class="easyui-textbox" name="menu_url" style="width:200px;"></input></td>
        </tr> 
        <tr>
            <td>权限名称：</td>
            <td><input class="easyui-textbox" name="menu_action" style="width:200px;"></td>
        </tr>
        <tr>
            <td>排序：</td>
            <td><input class="easyui-numberbox" name="menu_sort" data-options="min:1,max:100,required:true" missingMessage="输入排序号，1-100以内" style="width:200px;"></td>
        </tr>
		<tr>
            <td>节点图标：</td>
            <td><input class="easyui-textbox" name="menu_iconCls" style="width:200px;"></td>
        </tr>     
    </table>
	<input type="hidden" name="menu_id">
    <input type="hidden" name="priv_id">
</form>
</div>
<div id="menu_edit_sub" style="padding:20px; border-top:1px solid #CCC; display:none">
	 <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveMenu()">保存</a>
     <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="delMenu()">删除</a>
</div>
<div id="menu_new_sub" style="padding:20px; border-top:1px solid #CCC; display:block;">
	<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveMenu()">新建</a>
</div>
<script>
function menu_s_tree(pid){
	$('#menu_parent_id').combotree({
		url: '<?php echo base_url('systemmanage/menu_data?_=')?>'+GetRandomNum(),
		method:'post',
		required: true,
		panelHeight: 400
	});
	if(pid){
		$('#menu_parent_id').combotree('setValue', pid);
	}
}
menu_s_tree();
function menu_f_loadLocal(m){//填充表单数据
	$('#menu_f').form('load',{
		menu_id:'<?php echo @$menuinfo[0]['id'];?>',
		priv_id:'<?php echo @$menuinfo[0]['priv_id'];?>',
		menu_title:'<?php echo @$menuinfo[0]['text'];?>',
		parent_id:'<?php echo $menuinfo[0]['parentId']?>',
		menu_url:'<?php echo @$menuinfo[0]['attributes']['url'];?>',
		menu_action:'<?php echo @$menuinfo[0]['m_action'];?>',
		menu_sort:'<?php echo @$menuinfo[0]['sort'];?>',
		menu_iconCls:'<?php echo @$menuinfo[0]['iconCls'];?>'
	});
	if(m == 'edit'){
		$("#menu_edit_sub").show();
		$("#menu_new_sub").hide();
	}else{
		$("#menu_edit_sub").hide();
		$("#menu_new_sub").show();
	}
}
</script>
